package com.aaa.service;

import com.aaa.dao.HeadDao;
import com.aaa.dao.PersonalDao;
import com.aaa.pojo.Personal;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @Classname PersonalService
 * @Description TODO
 * @Date 2020/12/3 8:25
 * @Created by 腾飞
 */
@Service
public class PersonalService {
    @Autowired
    private PersonalDao personalDao;
    @Autowired
    private HeadDao headDao;

    //查询个人信息
    public Personal queryPersonalById(Integer uid){
        return personalDao.queryPersonalById(uid);
    }
    //修改头像
    public void updatePersonalById(String pname,Integer uid){
        Integer url_id = headDao.queryHeadByName(pname).getUrl_id();
        personalDao.updatePersonalById(url_id,uid);
    }
    //上传头像
    public void IntegerPersonal(String pname,Integer uid){
        headDao.insertHead(pname);
        Integer url_id = headDao.queryHeadByName(pname).getUrl_id();
        personalDao.updatePersonalById(url_id,uid);
    }
}
